$(function () {
  let layer = layui.layer
  let form = layui.form
  // 粒子线条背景
  $(document).ready(function () {
    $('.layui-container').particleground({
      dotColor: '#7ec7fd',
      lineColor: '#7ec7fd'
    })
  })
  // 获取用户输入的内容
  $("form").on("submit", function (e) {
    console.log(1);
    // 阻止默认
    e.preventDefault()
    // 获取数据
    let data = $(this).serialize()
    // 登录操作
    $.ajax({
      url: "/api/login",
      type: "POST",
      data: data,
      success: function (res) {
        console.log(res);
        layer.msg(res.message)
        location.href = "/index.html"
        localStorage.setItem("mytoken", res.token)
      }
    })
  })


})